<?php

include_once '../@base/portal.php';
include_once '../login/login.php';

$user = $post->value;
$payload = $post->model;

$login = login($user->number, $user->passwd);
if ($login['status'] == 0 && $login['userbase']['level'] > 1) {
    output(createUser($payload));
} else {
    output(['status' => 1]);
}

function createUser($payload)
{
    $sql = "INSERT INTO oprec_security_data VALUES({$payload->number},'{$payload->name}','{$payload->clientName}','{$payload->clientOffice}','{$payload->clientGroup}','{$payload->clientRank}','{$payload->interest}','{$payload->rank}','appapp','{$payload->level}')";
    return exec_sql($sql);
}
